import 'package:fate_blind_box/ui/user/Settings/logoutSendCodeDilog.dart';
import 'package:flutter/material.dart';

import '../../../network/Api.dart';
import '../../../theme/theme_color.dart';
import '../../../utils/page.dart';
import '../../../utils/provider.dart';
import '../../../utils/snack_bar.dart';

class SendCodeUI extends StatelessWidget {
  const SendCodeUI({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body:SingleChildScrollView(

        child: _SendCodePage(),
      ),
    );
  }

}

class _SendCodePage extends StatefulWidget {
  const _SendCodePage({Key? key}) : super(key: key);

  @override
  State createState() {
    return _SendCodeState();
  }
}

class _SendCodeState extends State<_SendCodePage> {

  @override
  void initState() {

    super.initState();

    _meMemberLogout();
  }

  _meMemberLogout() async {
    final res = await Api.getInstance().memberLogout(Provider.memberId);
    final data = res['data'];

    if (res['code'] == 0 && res['data'] != null) {

      ThemeSnackBar.show(context, '注销成功');
      Navigate.toLogin();
    } else {
      ThemeSnackBar.show(context, '注销失败');
    }
  }

  Widget build(BuildContext context) {

    return Scaffold(
        appBar: AppBar(
          title: const Text(
            '注销账号',
            style: TextStyle(color: Colors.black, fontSize: 16),
          ),
        ),
        body: SingleChildScrollView(
          child: Center(
              child: Column(
                // crossAxisAlignment: CrossAxisAlignment.center,
                // mainAxisAlignment: MainAxisAlignment.center,
                // verticalDirection: VerticalDirection.down,

                children: [
                  const SizedBox(height: 69,),
                  const Image(
                    width: 122,
                    height: 122,
                    image: AssetImage("images/ic_logoutTop.png"),
                  ),
                  const SizedBox(height: 30,),
                  Text('请帮助我们验证你的身份',style: TextStyle(color: ThemeColor.textColor, fontSize: 16,fontWeight: FontWeight.bold),),
                  const SizedBox(height: 10,),
                  Text('注意：验证完成后，您的偶然遇见账号将被注销并将删除\n对应账号极其绑定信息，所有账号数据均无法恢复',style: TextStyle(color: ThemeColor.textColorSecond, fontSize: 12,),maxLines: 2,),
                  const SizedBox(height: 74,),
                  GestureDetector(
                    child: Container(
                        margin: const EdgeInsets.fromLTRB(59, 30, 59, 0),
                        height: 45,
                        decoration: ShapeDecoration(
                          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(22.5)),
                          color: const Color(0xFF7F69D9),
                        ),
                        width: double.maxFinite,
                        child: const Center(
                          child: Text(
                            "发送短信验证",
                            style: TextStyle(
                              color: Colors.white,
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        )
                    ),
                    onTap: () {

                      UpdateDialog.showUpdateDialog(context);
                    },
                  ),
                ],
              )
          ),
        )
    );
  }
}


// Widget build(BuildContext context) {


    // TODO: implement build

  // }





